package com.amazon.dao;

import com.amazon.bo.Shop;
import com.amazon.bo.ShopGoodsBatch;
import com.amazon.dao.base.BaseDao;
import org.hibernate.query.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Repository
public class ShopGoodsBatchDao extends BaseDao<ShopGoodsBatch> {


    public ShopGoodsBatch selectFirstShopGoodsBatch() {
        List<ShopGoodsBatch> shopGoodsBatch= execute(session -> session
                .createNativeQuery("SELECT * FROM shop_goods_batch where batch_status!=5 and batch_status!=4 order by id asc limit 1 ", ShopGoodsBatch.class)
                .getResultList());
        return  shopGoodsBatch.size()>0?shopGoodsBatch.get(0):null;
    }
}
